<?php
/**
 * Created by PhpStorm.
 * User: syzx
 * Date: 2011/1/1
 * Time: 1:08
 */
function zhuanghuan($word){
    $arr=explode("_",$word);
    switch(count($arr)){
        case 2:
            $arr[0]=substr_replace($arr[0],"C",0,1);
            $arr[1]=substr_replace($arr[1],"A",0,1);
            $w=implode("_",$arr);break;
        case 3:
            $arr[0]=substr_replace($arr[0],"H",0,1);
            $arr[1]=substr_replace($arr[1],"A",0,1);
            $arr[2]=substr_replace($arr[2],"Y",0,1);
            $w=implode("",$arr);
            break;
        default:
            break;
    }
    return $w;
}
$s="cut_apple";
$w="how_are_you";
echo(zhuanghuan($s)."<br>");
echo(zhuanghuan($w));
?>